

const login = r => require.ensure([], () => r(require('@/components/login')), 'login');
const register = r => require.ensure([], () => r(require('@/components/register')), 'register');
const forgetPassword = r => require.ensure([], () => r(require('@/components/forget-password')), 'forgetPassword');
const home = r => require.ensure([], () => r(require('@/components/home')), 'home');
const user = r => require.ensure([], () => r(require('@/components/user/User')), 'user');

const author = r => require.ensure([], () => r(require('@/components/author')), 'author');
const redirect = r => require.ensure([], () => r(require('@/components/redirect')), 'redirect');

const Contrast  = r => require.ensure([], () => r(require('@/components/statistics/Contrast')), 'Contrast');

const amap  = r => require.ensure([], () => r(require('@/components/amap')), 'amap');


const equipment  = r => require.ensure([], () => r(require('@/components/equipment/equipment-management')), 'equipment');
const equipmentChange  = r => require.ensure([], () => r(require('@/components/equipment/equipment-change')), 'equipmentChange');
const patrolManagement  = r => require.ensure([], () => r(require('@/components/equipment/patrol-management')), 'patrolManagement');
const patrolDetail  = r => require.ensure([], () => r(require('@/components/equipment/patrol-detail')), 'patrolDetail');
const publishMalfunction  = r => require.ensure([], () => r(require('@/components/equipment/publish-malfunction')), 'publishMalfunction');
const malfunctionManagement  = r => require.ensure([], () => r(require('@/components/equipment/malfunction-management')), 'malfunctionManagement');
const malfunctionDetail  = r => require.ensure([], () => r(require('@/components/equipment/malfunction-detail')), 'malfunctionDetail');
const maintainAssignment  = r => require.ensure([], () => r(require('@/components/equipment/maintain-assignment')), 'maintainAssignment');

const monitor  = r => require.ensure([], () => r(require('@/components/monitor/monitor-warning')), 'monitor');
const realData  = r => require.ensure([], () => r(require('@/components/monitor/real-data')), 'realData');
const historyData  = r => require.ensure([], () => r(require('@/components/monitor/history-data')), 'historyData');
const alarmInformation  = r => require.ensure([], () => r(require('@/components/monitor/alarm-information')), 'alarmInformation');

let wx = process.env.WX_CONFIG;

const routers = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    title:'登录',
    component: login
  },
  {
    path: '/register',
    name: 'register',
    title:'注册',
    component: register
  },
  {
    path: '/forgetPassword',
    name: 'forgetPassword',
    title:'忘记密码',
    component: forgetPassword
  },
  /*{
    path: '/',
    redirect: '/home'
  },*/
  {
    path: '/home',
    name: 'home',
    title:'智慧LNG',
    component: home
  },
  {
    path: '/user',
    name: 'user',
    title:'我的LNG',
    component: user
  },
  {
    path: '/amap',
    name: 'amap',
    title:'地图展示',
    component: amap
  },
  {
    path: '/author',
    name: 'author',
    component: author,
    //redirect: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wx.appId}&redirect_uri=${wx.redirect_outh}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`,
  },
  {
    path: '/redirect',
    name: 'redirect',
    component: redirect
  },
  {
    path: '/contrast',
    name: 'contrast',
    title:'统计分析',
    component: Contrast
  },
  {
    path: '/equipment',
    name: 'equipment',
    title:'设备管理',
    component: equipment
  },
  {
    path: '/equipmentChange',
    name: 'equipmentChange',
    title:'更换设备',
    component: equipmentChange
  },
  {
    path: '/patrolDetail',
    name: 'patrolDetail',
    title:'巡检详情',
    component: patrolDetail
  },
  {
    path: '/patrolManagement',
    name: 'patrolManagement',
    title:'巡检管理',
    component: patrolManagement
  },
  {
    path: '/publishMalfunction',
    name: 'publishMalfunction',
    title:'发布故障',
    component: publishMalfunction
  },
  {
    path: '/malfunctionManagement',
    name: 'malfunctionManagement',
    title:'故障管理',
    component: malfunctionManagement
  },
  {
    path: '/maintainAssignment',
    name: 'maintainAssignment',
    title:'维修任务',
    component: maintainAssignment
  },
  {
    path: '/malfunctionDetail',
    name: 'malfunctionDetail',
    title:'故障详情',
    component: malfunctionDetail
  },
  {
    path: '/monitor',
    name: 'monitor',
    title:'监控预警',
    component: monitor
  },
  {
    path: '/realData',
    name: 'realData',
    title:'实时数据',
    component: realData
  },
  {
    path: '/historyData',
    name: 'historyData',
    title:'历史数据',
    component: historyData
  },
  {
    path: '/alarmInformation',
    name: 'alarmInformation',
    title:'报警信息',
    component: alarmInformation
  }


];
export default routers;
